package com.hex.campus.backend.hex_campus_backend.service;

import com.hex.campus.backend.hex_campus_backend.entity.Profile;
import com.hex.campus.backend.hex_campus_backend.entity.User;
import com.hex.campus.backend.hex_campus_backend.repository.ProfileRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class ProfileService {

    @Autowired
    private ProfileRepository profileRepository;

    public Optional<Profile> getProfileByUserId(Long userId) {
        return profileRepository.findByUserId(userId);
    }

    public Profile createOrUpdateProfile(Profile profile) {
        return profileRepository.save(profile);
    }
}